Extended Backus-Naur form

Extended Backus-Naur Form is based on a suggestion by Niklaus Wirth.

EBNF의 설계 목표:

  • Concise, so that languages can be defined briefly and thus be more easily undertood;
  • Precise, so that the rules are unambiguous;
  • Formal, so that the rules can be parsed, or otherwise processed, by a computer when requried;
  • Natural, so that the notation and format are relatively simple to learn and understand, even for those who are not themselves language designers;
  • General, so that the notation is suitable for many purposes including the description of many different languages;
  • Simple in its character set and with a notation that avoids, as far as is practicable, using characters that are not generally available on standard keyboards so that the rules an be typed and can be processed by computer programs;
  • self describing, so that the notation is able to describe itself;
  • linear, so that the syntax can be expressed as a single stream of characters.

The main differences:

  • Terminal symbols of the language are quoted so that any character, including one used in EBNF, can be defined as a terminal symbol of the language eing defined.
  • [ and ] indicate optional symbols.
  • { and } indicate repetition.
  • Each rule has an explicit final character so that there is never any ambiguity about where a rule ends.
  • Brackets group items together. It is an obvious convenience to use ( and ) in their ordinary mathematical sense.

Limitations:

  • The main limitation is that the language being defined needs to be linear, i.e. the symbols in a sentence of the language can be placed in an ordered sequence. For example, electric circuit diagrams are not linear language.
  • A further limitation is that EBNF is inadequate for defining more complex forms of grammars.

Example:

  • ISO 표준의 뒷부분에서 EBNF 스스로를 정의하는 EBNF를 볼 수 있다.

2024 © ak